home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 August: Tool Chest / Dev.CD Aug 98 TC.toast / Tool Chest / Testing & Debugging / Mac OS Development Toolkit / Automation Essentials 2.3.0 / Host Automation Folder / VU External Tool libs / FileToolOperations.Lib < prev    next >
Encoding:
Text File  |  1998-03-19  |  20.4 KB  |  571 lines  |  [TEXT/MPS ]

  1. #
  2. # ****************************************************************************
  3. #
  4. #    File Name:    FileToolOperations.Lib
  5. #
  6. #    Contains:    Tasks which extend the basic functionality of the FileTool.vulib.
  7. #
  8. #    Written by:    KTA
  9. #
  10. #    Copyright:    © 1993-1997 by Apple Computer, Inc., all rights reserved.
  11. #
  12. # ****************************************************************************
  13. #            C h a n g e        H i s t o r y (most recent first):
  14. # ****************************************************************************
  15. #
  16. #        Vers      Date        Author        Description
  17. #        ----    --------    ------    ---------------------------------------------
  18. #        2.2.2    2/12/97        JAS        Added 'vers' resources to library.
  19. #                                    These should always match tool version when tool is revved.
  20. #        <15>     2/23/96    JC        Add TRACS support.
  21. #        <14>     4/25/95    KTA        ExistsOrCreate() - Fixed bug where returnVal was being set
  22. #                                    incorrectly.
  23. #        <13>     2/16/95    KTA        _FileTool() - Replaced with standard new version of standard
  24. #                                    template which fixes some problems.
  25. #        <12>     1/31/95    KTA        Changed pOntarget parameter to true in many tasks.
  26. #        <11>     1/19/95    KTA        Changed the name of ExceptionHandler() to ExceptionDispatcher().
  27. #        <10>     1/13/95    KTA        _FileTool() - Added support for calling tasks as well as
  28. #                                    services.
  29. #         <9>      1/6/95    KTA        QuitFileTool() - created.
  30. #         <8>    12/12/94    KTA        _FileTool() - Changed match[target] to match[mouse];
  31. #         <7>    12/12/94    KTA        _FileTool() - Only match the target if pOnTarget is true
  32. #         <6>    12/12/94    KTA        Added task _FileTool for exceptionHandling, and updated tasks to
  33. #                                    call it.
  34. #         <5>     4/11/94    KTA        Updated library dependancy list.
  35. #         <4>     4/11/94    KTA        Added several new tasks
  36. #         <3>      4/7/94    KTA        ExistsOrCreate() - Support creation of folders.
  37. #         <2>      4/1/94    KTA        InitFileTool() -  gFileToolStatus, removed println.
  38. #         <1>     3/28/94    KTA        Created - first checked in.
  39. #
  40. # ****************************************************************************
  41. #
  42.  
  43. ########################################################################
  44. #                            External libraries 
  45. #=======================================================================
  46. Libraries "FileTool.vuLib", "FileToolHost.vuLib", "Output.Lib", "String.Lib", "ExceptionHandling.Lib";
  47.  
  48. #########################################################################
  49. #        _FileTool(pOnTarget := true)
  50. #========================================================================
  51. # Author:        KTA 
  52. # Description:    Does the exception handling for the Filetool.  All high level tasks
  53. #                should call this routine for file tool services or tasks within the
  54. #                FileTool.vulib.  Handles initialization of tool automatically.
  55. # Parameters:    pServiceorTask - Name of the Service or task
  56. #                pParamList - List of parameters
  57. #                pOnTarget - Flag to indicate whether the service should be performed 
  58. #                            the host or the target.  1 = target/0 = host.
  59. # Returns:        What ever the file tool returns - list of three elements
  60. #                            { errCode, Data, [error message]}
  61. # Examples:        _FileTool('ReadUntil', {'HD:FileName'},1);
  62. # Assumptions:    None 
  63. #========================================================================
  64. # History:
  65. # KTA    12/12/94    Only match the mouse if pOnTarget is true
  66. # KTA    1/13/95        Added support for calling tasks as well as services
  67. # KTA    2/16/95        coerce pOnTarget to be either true or false, Temporarily
  68. #                    turn commandexceptions off, check scripterror, reset 
  69. #                    commandexceptions, and if necessary throw scripterror 
  70. #  JC    2/19/96        Updated to support FiletToolHost calls from the "FileToolHost.vuLib" 
  71. #                    lib. This was done to support TRACS output support.
  72. #########################################################################
  73. TASK _FileTool(pServiceOrTask, pParamList := {}, pOnTarget := true, pIsRetry := 0)
  74. begin
  75.     Try
  76.     begin
  77.         returnVal := undefined;
  78.         ParamType := TypeOf(pServiceOrTask);
  79.         
  80.         if (ParamType = 'string') # Service Call
  81.         begin
  82.             if (pOnTarget)
  83.                 pOnTarget := true;
  84.             else
  85.                 pOnTarget := false;
  86.             if not(global gFileToolInitFlag = pOnTarget)
  87.             begin
  88.                 try
  89.                 begin
  90.                     temp := CommandExceptions(0);
  91.                     if (pOnTarget)
  92.                         FileToolInit :=  FileTool("Initialize", pOnTarget );         # initialize FileTool
  93.                     else
  94.                         FileToolInit :=  FileToolHost("Initialize", pOnTarget );         # initialize FileTool
  95.                     InitError := Scripterror();
  96.                     CommandExceptions(temp);
  97.                     if (FileToolInit[1] <> 0)        # If error
  98.                     begin
  99.                         println "FileTool error ( ", FileToolInit[1], ", ",  FileToolInit[3] , " )";
  100.                         gFileToolInitFlag := undefined;
  101.                         if (CommandExceptions())
  102.                             throw InitError;
  103.                         return(FileToolInit);
  104.                     end;
  105.                     else
  106.                         gFileToolInitFlag := pOnTarget;
  107.                 end;
  108.                 catch theErr
  109.                 begin
  110.                     ExceptionDispatcher(theErr);
  111.                     return(FileToolInit);
  112.                 end;
  113.             end;
  114.         
  115.             try
  116.             begin
  117.                 NumParams := Card(pParamList);
  118.                 if (pOnTarget)
  119.                 begin
  120.                     switch NumParams
  121.                     begin
  122.                         case 0:                    # 0 parameters
  123.                             returnVal := FileTool(pServiceOrTask); 
  124.                         case 1:                    # 1 parameter
  125.                             returnVal := FileTool(pServiceOrTask, pParamList[1]); 
  126.                         case 2:                    # 2 parameters
  127.                             returnVal := FileTool(pServiceOrTask, pParamList[1], pParamList[2]); 
  128.                         case 3:                    # 3 parameters
  129.                             returnVal := FileTool(pServiceOrTask, pParamList[1], pParamList[2], pParamList[3]); 
  130.                         case 4:                    # 4 parameters
  131.                             returnVal := FileTool(pServiceOrTask, pParamList[1], pParamList[2], pParamList[3], pParamList[4]); 
  132.                         case 5:                    # 5 parameters
  133.                             returnVal := FileTool(pServiceOrTask, pParamList[1], pParamList[2], pParamList[3], pParamList[4], pParamList[5]); 
  134.                         case 6:                    # 6 parameters
  135.                             returnVal := FileTool(pServiceOrTask, pParamList[1], pParamList[2], pParamList[3], pParamList[4], pParamList[5], pParamList[6]); 
  136.                         default:                # error
  137.                             println "Error - unsupported number of parameters - {NumParams}";
  138.                     end;
  139.                 end;
  140.                 else
  141.                 begin
  142.                     switch NumParams
  143.                     begin
  144.                         case 0:                    # 0 parameters
  145.                             returnVal := FileToolHost(pServiceOrTask); 
  146.                         case 1:                    # 1 parameter
  147.                             returnVal := FileToolHost(pServiceOrTask, pParamList[1]); 
  148.                         case 2:                    # 2 parameters
  149.                             returnVal := FileToolHost(pServiceOrTask, pParamList[1], pParamList[2]); 
  150.                         case 3:                    # 3 parameters
  151.                             returnVal := FileToolHost(pServiceOrTask, pParamList[1], pParamList[2], pParamList[3]); 
  152.                         case 4:                    # 4 parameters
  153.                             returnVal := FileToolHost(pServiceOrTask, pParamList[1], pParamList[2], pParamList[3], pParamList[4]); 
  154.                         case 5:                    # 5 parameters
  155.                             returnVal := FileToolHost(pServiceOrTask, pParamList[1], pParamList[2], pParamList[3], pParamList[4], pParamList[5]); 
  156.                         case 6:                    # 6 parameters
  157.                             returnVal := FileToolHost(pServiceOrTask, pParamList[1], pParamList[2], pParamList[3], pParamList[4], pParamList[5], pParamList[6]); 
  158.                         default:                # error
  159.                             println "Error - unsupported number of parameters - {NumParams}";
  160.                     end;
  161.                 end;
  162.         
  163.                 if (returnVal[1] <> 0)        # If error
  164.                 begin
  165.                     if(returnVal[1] = -1) and not (pIsRetry)    # Not initialized, and haven't retried already
  166.                     begin
  167.                         global gFileToolInitFlag := undefined;
  168.                         returnVal := _FileTool(pServiceOrTask, pParamList, pOnTarget, 1);
  169.                     end;
  170.                 end;
  171.                 else if(pServiceOrTask = 'Quit')        # Reset the global gFileToolInitFlag when we quit
  172.                     global gFileToolInitFlag := undefined;
  173.             
  174.             end;
  175.             catch theErr
  176.             begin
  177.                 if(theErr = -1220) and not (pIsRetry)
  178.                 begin
  179.                     global gFileToolInitFlag := undefined;
  180.                     returnVal := _FileTool(pServiceOrTask, pParamList, pOnTarget, 1);
  181.                 end;
  182.                 else
  183.                     exceptionDispatcher(theErr);
  184.                 end;
  185.             end;
  186.             else if(ParamType = 'task')
  187.             begin
  188.                 NumParams := Card(pParamList);
  189.             switch NumParams 
  190.             begin
  191.                 case 0:                    # 0 parameters
  192.                     returnVal := call (pServiceOrTask); 
  193.                 case 1:                    # 1 parameter
  194.                     returnVal := call (pServiceOrTask, pParamList[1]); 
  195.                 case 2:                    # 2 parameters
  196.                     returnVal := call (pServiceOrTask, pParamList[1], pParamList[2]); 
  197.                 case 3:                    # 3 parameters
  198.                     returnVal := call (pServiceOrTask, pParamList[1], pParamList[2], pParamList[3]); 
  199.                 case 4:                    # 4 parameters
  200.                     returnVal := call (pServiceOrTask, pParamList[1], pParamList[2], pParamList[3], pParamList[4]); 
  201.                 case 5:                    # 5 parameters
  202.                     returnVal := call (pServiceOrTask, pParamList[1], pParamList[2], pParamList[3], pParamList[4], pParamList[5]); 
  203.                 case 6:                    # 6 parameters
  204.                     returnVal := call (pServiceOrTask, pParamList[1], pParamList[2], pParamList[3], pParamList[4], pParamList[5], pParamList[6]); 
  205.                 default:                # error
  206.                     println "Error - unsupported number of parameters - {NumParams}";
  207.             end;
  208.         end;
  209.         
  210.         if(pOnTarget)            # To cause target errors to throw if Xtools are called
  211.             match[mouse];
  212.             
  213.         return(returnVal);
  214.     end;
  215.     Catch theError
  216.         ExceptionDispatcher(theError);
  217. end;
  218.  
  219. #########################################################################
  220. #        InitFileTool(pOnTarget := true)
  221. #========================================================================
  222. # Author:        KTA 
  223. # Description:    Initializes the FileTool 
  224. # Parameters:    pOnTarget - True if you want to launch the FileTool on  
  225. #                                the target machine. False if on the Host.
  226. # Returns:        0 - Couldn't initialize
  227. #                1 - Init On Target
  228. #                2 - Init On Host
  229. # Examples:        InitFileTool();
  230. # Assumptions:    None 
  231. #========================================================================
  232. # History:
  233. # KTA    12/12/94    Updated to call _FileTool()
  234. #########################################################################
  235. TASK InitFileTool(pOnTarget := true)
  236. begin
  237.     returnVal := 0;
  238.     FileToolInit :=  _FileTool( "Initialize", {pOnTarget}, pOnTarget);         # Launch FileTool
  239.     if FileToolInit[1] <> 0                                    # If error during initialization,
  240.     begin
  241.         println "FileTool could not be initialized";        # print error
  242.         println "Error ", FileToolInit[1], ". ",  FileToolInit[3] ;
  243.     end;
  244.     else
  245.     begin
  246.         if (pOnTarget)        # Was it on the Target
  247.             returnVal := 1;
  248.         else                     # Or was it on the Host
  249.             returnVal := 2;
  250.  
  251.     end;
  252.     return(returnVal);
  253. end;
  254. #########################################################################
  255. #        QuitFileTool()
  256. #========================================================================
  257. # Author:        KTA 
  258. # Description:    Quits the FileTool 
  259. # Parameters:    none
  260. # Returns:        0 - Couldn't Quit
  261. #                1 - Quit Successfully
  262. # Examples:        QuitFileTool();
  263. # Assumptions:    None 
  264. #========================================================================
  265. # History:
  266. # KTA    1/6/95    Created
  267. #########################################################################
  268. TASK QuitFileTool(pOnTarget := true)
  269. begin
  270.     FileToolQuit :=  _FileTool( "Quit", ,pOnTarget);         # Quit FileTool
  271.     if (FileToolQuit[1] <> 0)                                    # If error during initialization,
  272.     begin
  273.         println "FileTool could not be quit";        # print error
  274.         println "Error ", FileToolQuit[1], ". ",  FileToolQuit[3] ;
  275.         returnVal := 0;    # Error
  276.     end;
  277.     else
  278.         returnVal := 1;    # Success
  279.     return(returnVal);
  280. end;
  281.  
  282.  
  283. #########################################################################
  284. #        ReadTheLine( pFileReference, pFromPosition, pOnTarget )
  285. #========================================================================
  286. # Author:        KTA 
  287. # Description:    Similar to ReadLine in ?FileTool.vulib except this routine does the error
  288. #                checking and will return 0 if an error occur otherwise it will 
  289. #                what the line that was read (2nd element of what theFileTool returned)
  290. # Parameters:    pFileReference - File to read from.  
  291. #                pFromPosition - position to begin reading from.
  292. # Returns:        0 - Some Error
  293. #                String - line read
  294. # Examples:        ReadTheLine('hd:myFile', 0);
  295. # Assumptions:    None 
  296. #========================================================================
  297. # History:
  298. # KTA    12/12/94    Updated to call _FileTool()
  299. #########################################################################
  300. task ReadTheLine( pFileReference, pFromPosition := 0, pOnTarget := true )
  301. begin
  302.     theLine := _Filetool('ReadUntil', {pFileReference, 0, "∂n", pFromPosition}, pOnTarget );
  303.     if(theLine[1] <> 0)
  304.     begin 
  305.         println "Problem reading the file";        # print error
  306.         println "Error ", theLine[1], ". ",  theLine[3] ;
  307.         returnVal := undefined;
  308.     end;
  309.     else
  310.         returnVal := theLine[2];
  311.     return (returnVal);
  312. end;
  313.  
  314.  
  315. #########################################################################
  316. #                        ExistsOrCreate(pFileName, pOnTarget)
  317. #========================================================================
  318. # Author:        KTA
  319. # Description:    Checks to see if the <pFileName> exists - creates one if it does not.
  320. # Parameters:    pFileName - full path of file
  321. # Returns:        0 - Fail (doesn't exist, couldn't create)
  322. #                1 - File Existed 
  323. #                2 - Created File 
  324. #                3 - Created Folder 
  325. # Examples:        ExistsOrCreate();
  326. # Assumptions:    None 
  327. #========================================================================
  328. # History:
  329. # KTA    4/7/94    Support creation of folders
  330. # KTA    12/12/94    Updated to call _FileTool()
  331. # KTA    4/25/95        Fixed bug where returnVal was being set incorrectly
  332. #########################################################################
  333. task ExistsOrCreate(pFileName, pOnTarget := true )
  334. begin
  335.     returnVal := 0;
  336.     ###    Create the file only if it doesn't exist
  337.     x := _FileTool( "FileExists", {pFileName}, pOnTarget);
  338.     if not (TypeOf( x ) = 'list' and x[1] = 0)
  339.     begin
  340.         strLen := Card(pFileName);
  341.         if( pFileName[strLen] = ':')
  342.         begin
  343.             CreatedFolder := _FileTool( "CreateFolder", {pFileName} , pOnTarget); 
  344.             If(CreatedFolder[1] = 0)    # Folder was created
  345.                 returnVal := 3;
  346.             else    
  347.             begin
  348.                 Println "!@#$% An error occured while creating the file";
  349.                 Println "Error", CreatedFolder[1], CreatedFolder[3];
  350.             end;
  351.         end;
  352.         else
  353.         begin
  354.             ###    Create the File
  355.             CreatedFile := _FileTool( "Create", {pFileName,'MPS ', 'TEXT'}, pOnTarget );
  356.             If(CreatedFile[1] = 0)    # File was created
  357.                 returnVal := 2;
  358.             else    
  359.             begin
  360.                 Println "!@#$% An error occured while creating the file";
  361.                 Println "Error", CreatedFile[1], CreatedFile[3];
  362.             end;
  363.         end;
  364.     end;
  365.     else        # File must Exist
  366.         returnVal := 1;
  367.  
  368.     return(returnVal);
  369. end;
  370.  
  371.  
  372. #########################################################################
  373. #                MoveTheFile(pSourcePath, pDestinationPath, pOnTarget)
  374. #========================================================================
  375. # Author:        KTA 
  376. # Description:    Moves Files from <pSourcePath> to <pDestinationPath>
  377. #                
  378. # Parameters:    pSourcePath - (String) Fullpath location of file to be moved. Should 
  379. #                            be in the form: "HD:Folder:FileName".
  380. #                pDestinationPath - (String) Fullpath location where file should be
  381. #                                moved to. Should be in the form: "HD:Folder:FileName2" where 
  382. #                                FileName2 is the new name for the file.
  383. #                
  384. # Returns:        0 - error occured
  385. #                integer - file reference for file moved.
  386. # Assumptions:     File exists in <pSourcePath> and <pDestinationPath> is a valid path.  
  387. #                This routine does not check to see if either exist nor does it 
  388. #                return errors if either is not found.
  389. #========================================================================
  390. # History:
  391. # KTA    3/29/94    created
  392. # KTA    12/12/94    Updated to call _FileTool()
  393. #########################################################################
  394. TASK MoveTheFile(pSourcePath, pDestinationPath, pOnTarget := true )
  395. begin
  396.     theMove := _FileTool( "Move", {pSourcePath,0,pDestinationPath}, pOnTarget); 
  397.     if(theMove[1] <> 0)
  398.     begin 
  399.         println "Problem moving the file";        # print error
  400.         println "Error ", theMove[1], ". ",  theMove[3] ;
  401.         returnVal := 0;
  402.     end;
  403.     else
  404.     begin
  405.         returnVal := theMove[2];
  406.         LogStr("Moving the file '{pSourcePath}' to '{pDestinationPath}'");
  407.     end;
  408.     return (returnVal);
  409. end;
  410.  
  411. #########################################################################
  412. #                        DoesFileExist(pFilePath, pOnTarget)
  413. #========================================================================
  414. # Author:        KTA 
  415. # Description:    This task checks to see if the file <pFilePath> exists.
  416. # Parameters:    pFilePath - full path to a file.
  417. # Returns:        0 - File does not exist.
  418. #                1 - file exists
  419. #========================================================================
  420. # History:
  421. # KTA    1/6/94    created
  422. # KTA    12/12/94    Updated to call _FileTool()
  423. #########################################################################
  424. TASK DoesFileExist(pFilePath := "", pOnTarget := true)
  425. begin
  426.     returnVal := 0;
  427.     x :=  _FileTool( "FileExists", {pFilePath},pOnTarget);
  428.     if(x[1] = -43)
  429.     begin
  430.         #println  "The file '{pFilePath}' does not exist";
  431.     end;
  432.     else if(x[1] <> 0)
  433.         println "Error: ", x[1], "    ", x[3];
  434.     else if (x[2])
  435.     begin
  436.         #println "The file '{pFilePath}' exists";
  437.         returnVal :=1;
  438.     end;
  439.  
  440.     return(returnVal);
  441. end;
  442.  
  443. #########################################################################
  444. #                        PathToSpecialFolder(pSpecialFolder, pOnTarget)
  445. #========================================================================
  446. # Author:        KTA 
  447. # Description:    Returns the path to the special folder.
  448. # Parameters:    None
  449. # Returns:        0 - error occured
  450. #                string - full path to system folder in following format:
  451. #                "hd:Systemfolder"
  452. #    x := PathToSpecialFolder("extn" );
  453. #    x := PathToSpecialFolder("ctrl" );
  454. #    x := PathToSpecialFolder("macs" );
  455. #========================================================================
  456. # History:
  457. # KTA    1/6/94    created
  458. # KTA    12/12/94    Updated to call _FileTool()
  459. #########################################################################
  460. TASK PathToSpecialFolder(pSpecialFolder := '', pOnTarget := true)
  461. begin
  462.  
  463.     x := _FileTool( "FindFolder", {pSpecialFolder}, pOnTarget);
  464.     if(x[1] <>0)
  465.     begin
  466.         println "Error: ", x[1], "    ", x[3];
  467.         return(0);
  468.     end;
  469.     else
  470.         return(x[2]);
  471. end;
  472.  
  473. #########################################################################
  474. #                        NameOfBootVolume(pOnTarget)
  475. #========================================================================
  476. # Author:        KTA 
  477. # Description:    Returns the name of the boot volume
  478. # Parameters:    None
  479. # Returns:        0 - error occured
  480. #                string - Name of the boot volume
  481. #========================================================================
  482. # History:
  483. # KTA    1/6/94    created
  484. # KTA    12/12/94    Updated to call _FileTool()
  485. #########################################################################
  486. TASK NameOfBootVolume(pOnTarget := true)
  487. begin
  488.     x := _FileTool( "VolumeList", ,pOnTarget);
  489.     if(x[1] <>0)
  490.     begin
  491.         println "Error: ", x[1], "    ", x[3];
  492.         return(0);
  493.     end;
  494.     else
  495.         return(x[2][1]);
  496. end;
  497.  
  498. #########################################################################
  499. #                        DeleteTheFile(pFileName, pOnTarget)
  500. #========================================================================
  501. # Author:        KTA 
  502. # Description:    Deletes the file <pFileName>
  503. # Parameters:    pFileName - full path to the file to be deleted.
  504. # Returns:        0 - error occured
  505. #                1 - file was deleted properly
  506. #========================================================================
  507. # History:
  508. # KTA    1/6/94    created
  509. # KTA    12/12/94    Updated to call _FileTool()
  510. #########################################################################
  511. TASK DeleteTheFile(pFileName, pOnTarget := true)
  512. begin
  513.     x :=  _FileTool( "Delete", {pFileName,0},pOnTarget);
  514.     if(x[1] <>0)
  515.     begin
  516.         println "Error: ", x[1], "    ", x[3];
  517.         return(0);
  518.     end;
  519.     else
  520.     begin
  521.         Println "Deleted file '{pFileName}'";
  522.         return(1);
  523.     end;
  524. end;
  525.  
  526.  
  527. #########################################################################
  528. #                CopyFileToPath(pFileToCopy,pDestinationPath, pOnTarget)
  529. #========================================================================
  530. # Author:        KTA 
  531. # Description:    Copies the file <pFileToCopy> to the directory specified by 
  532. #                the input parameter <pDestinationPath>.
  533. #                Folder. This must be the full path of the file not just the filename.
  534. # Parameters:    pFileToCopy - Full path to source file in the form: "hd:fileName"
  535. # Returns:        0 - error occured
  536. #                1 - file was copied properly
  537. #========================================================================
  538. # History:
  539. # KTA    3/29/94    created
  540. # KTA    12/12/94    Updated to call _FileTool()
  541. #########################################################################
  542. TASK CopyFileToPath(pFileToCopy := '', pDestinationPath := 'SystemFolder', pOnTarget := true)
  543. begin
  544.     returnVal := 0;
  545.     if(pFileToCopy)
  546.     begin
  547.         if (pDestinationPath = 'SystemFolder')
  548.             pDestinationPath := PathToSpecialFolder('macs');
  549.  
  550.         ExistsFlag := DoesFileExist(pFileToCopy);
  551.         if(ExistsFlag)
  552.         begin
  553.             n := NumTimesCharInString(pFileToCopy, ':');
  554.             theFile := StringAfterChar(pFileToCopy, ':',0,n);
  555.             x := _FileTool( "CopyFile",{pFileToCopy, 0,"{pDestinationPath}{theFile}"}, pOnTarget );
  556.             if(x[1] <>0)
  557.             begin
  558.                 println "Error: ", x[1], "    ", x[3];
  559.             end;
  560.             else
  561.             begin
  562.                 println "Copied '{pFileToCopy}' to '{pDestinationPath}'";
  563.                 returnVal := 1;
  564.             end;
  565.         end;
  566.     end;
  567.     else
  568.         println "The file to copy was not specified";
  569.         
  570.     return(returnVal);
  571. end;